﻿<%@ Page Language="C#" MasterPageFile="~/design/UmelecM.Master" AutoEventWireup="true"
    CodeFile="Dila.aspx.cs" Inherits="Zadani09.umelec.Dila" Title="Správa děl" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LoginPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MenuPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentVrchniPlaceholder" runat="server">
    <h2 style="margin-bottom: 2px">
        Seznam děl</h2>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
        <ContentTemplate>
            <asp:TextBox ID="TextBox1" runat="server">
            </asp:TextBox>
            <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters=""
                Enabled="True" ServicePath="" TargetControlID="TextBox1" UseContextKey="True"
                ServiceMethod="GetCompletionList" MinimumPrefixLength="1">
            </cc1:AutoCompleteExtender>
            &nbsp;
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                <asp:ListItem Value="id_dilo" Text="ID díla">
                </asp:ListItem>
                <asp:ListItem Value="nazev" Text="Název">
                </asp:ListItem>
                <asp:ListItem Value="popis" Text="Popis">
                </asp:ListItem>
                <asp:ListItem Value="dlouhy_popis" Text="Dlouhý popis">
                </asp:ListItem>
                <asp:ListItem Value="datum" Text="Datum">
                </asp:ListItem>
                <asp:ListItem Value="na_prodej" Text="Na prodej">
                </asp:ListItem>
                <asp:ListItem Value="ulice" Text="Ulice">
                </asp:ListItem>
                <asp:ListItem Value="popisne" Text="Popisné">
                </asp:ListItem>
                <asp:ListItem Value="mesto" Text="Město">
                </asp:ListItem>
                <asp:ListItem Value="psc" Text="PSČ">
                </asp:ListItem>
            </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>
    &nbsp;
    <asp:Button ID="Button1" runat="server" Text="Vyhledat" Font-Size="12px" onclick="Button1_Click" 
                                    style="height: 25px" />
    <asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" Width="740px"
        AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"
        DataKeyNames="IDDilo" CssClass="mar_top_3" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:CommandField SelectText="Detail" ShowSelectButton="True" 
                DeleteText="Smazat">
                <ItemStyle Font-Bold="True" />
            </asp:CommandField>
            <asp:BoundField DataField="IDDilo" HeaderText="ID" SortExpression="IDDilo" />
            <asp:BoundField DataField="Nazev" HeaderText="Název" SortExpression="Nazev" />
            <asp:BoundField DataField="Datum" HeaderText="Datum" SortExpression="Datum" />
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice" />
            <asp:BoundField DataField="Popisne" HeaderText="Č.p." SortExpression="Popisne" />
            <asp:BoundField DataField="Mesto" HeaderText="Město" SortExpression="Mesto" />
            <asp:BoundField DataField="PSC" HeaderText="PSČ" SortExpression="PSC" />
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis" Visible="False" />
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý popis" SortExpression="DlouhyPopis"
                Visible="False" />
            <asp:TemplateField HeaderText="Na prodej" SortExpression="NaProdej">
                <ItemTemplate>
                    <asp:Label ID="LabelNaProdej" runat="server" Text='<%# (Eval("NaProdej").ToString() == "1" ? "ano" : "ne") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <h2 style="margin-bottom: 2px">
        Přidání a editace díla</h2>
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="417px" AutoGenerateRows="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2"
        ForeColor="Black" GridLines="None" DataSourceID="ObjectDataSource2" DataKeyNames="IDDilo">
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="IDDilo" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                SortExpression="IDDilo">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Nazev" HeaderText="Název" SortExpression="Nazev">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Datum" HeaderText="Datum" SortExpression="Datum">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Popisne" HeaderText="Č.p." SortExpression="Popisne">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Mesto" HeaderText="Město" SortExpression="Mesto">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="PSC" HeaderText="PSČ" SortExpression="PSC">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý popis" SortExpression="DlouhyPopis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Je na prodej ?" SortExpression="NaProdej">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="20px" SelectedValue='<%# Bind("NaProdej") %>'
                        Width="150px">
                        <asp:ListItem Value="0">Ne</asp:ListItem>
                        <asp:ListItem Value="1">Ano</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList3" runat="server" Height="20px" SelectedValue='<%# Bind("NaProdej") %>'
                        Width="150px">
                        <asp:ListItem Value="0">Ne</asp:ListItem>
                        <asp:ListItem Value="1">Ano</asp:ListItem>
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="LabelNaProdej" runat="server" Text='<%# (Eval("NaProdej").ToString() == "1" ? "ano" : "ne") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" />
            </asp:TemplateField>
            <asp:CommandField InsertText="Vložit" NewText="Vložit nové dílo" ShowEditButton="True"
                ShowInsertButton="True" UpdateText="Aktualizuj">
                <ItemStyle Font-Bold="True" ForeColor="Red" />
            </asp:CommandField>
        </Fields>
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:DetailsView>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="Zadani09.db.Dilo"
        OldValuesParameterFormatString="original_{0}" SelectMethod="ctiJedno" TypeName="Zadani09.db.ODS.DiloDataObject"
        UpdateMethod="aktualizuj" InsertMethod="vloz">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="0" Name="id" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Zadani09.db.Dilo"
        DeleteMethod="smaz" OldValuesParameterFormatString="original_{0}" SelectMethod="cti_s_vyhledavanim"
        TypeName="Zadani09.db.ODS.DiloDataObject">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
            <asp:ControlParameter ControlID="TextBox1" DefaultValue="" Name="hledano" PropertyName="Text"
                Type="String" />
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="id_umelec" Name="atribut"
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentSpodniPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BottomPlaceholder" runat="server">
</asp:Content>
